<?php
/**
 * <https://y.st./>
 * Copyright © 2018 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$xhtml = array(
	'<{title}>' => 'Time to work on bags now',
	'takedown' => '2017-11-01',
	'<{body}>' => <<<END
<img src="/img/CC_BY-SA_4.0/y.st./weblog/2018/11/22.jpg" alt="A dirt path in my town that leads between two main roads" class="framed-centred-image" width="649" height="480"/>
<section id="drudgery">
	<h2>Drudgery</h2>
	<p>
		My discussion post for the day:
	</p>
	<blockquote>
		<p>
			The page we&apos;re supposed to read for this reading assignment no longer seems to exist:
		</p>
		<img src="/img/CC_BY-SA_4.0/y.st./coursework/CS4402/404_Not_Found.png" alt="404 Not Found" class="framed-centred-image" width="848" height="267"/>
		<p>
			However, we can get similar information from other sources.
		</p>
		<h3>Compilation steps</h3>
		<p>
			The first step is lexical analysis (MyTutor, n.d.).
			The source file is broken up into tokens.
			The source I used claimed that white space and comments are stripped at this stage, but there&apos;s really no need for that.
			If the white space were removed, some tokens would run together, ruining the program.
			Rather, more likely, white space and comments are ignored, except for as token separators.
			There&apos;s no need to strip them, as the code isn&apos;t modified in place.
			Rather, a new structure is built based on the code.
			A symbol table is also generated.
			That way, symbol names, types, and sizes can be known during the next step of compilation.
		</p>
		<p>
			Next, the compiler builds an abstract syntax tree from the tokens (MyTutor, n.d.).
			This allows the compiler to understand what the source code was trying to say.
			Just as importantly, it allows the compiler to know if the code&apos;s message even makes sense.
			If the tokens cannot be arranged as a syntax tree, there was some sort of error in the syntax of the initial code.
			The compiler halts and a syntax error is emitted.
			Several languages will try to include information about where they think the error is.
			In the case of some types of errors, the compiler fails to identify the error correctly, but the identified location is near where the actual error is.
			For example, when I forget to end a statement in a semicolon, the compiler tells me off about something on the next line being out of place.
			Checking the line before the alleged error reveals my real mistake.
		</p>
		<p>
			Third, the compiler builds the abstract syntax tree into a program (MyTutor, n.d.).
			The machine code is generated based on the syntax tree.
			This step is processor-specific, as different processors use different machine code languages.
		</p>
		<p>
			Finally, the compiled binary is examined and attempts at optimisation are made (MyTutor, n.d.).
			More-efficient substitutions are sought, as well as outright removal of redundant code.
		</p>
		<h3>Context-free grammars</h3>
		<p>
			A context-free grammar is a grammar in which valid statements are defined in terms of token replacement.
			For example, in a given context-free grammar, &quot;{statement}&quot; might be replaceable with &quot;{var} = {statement}&quot;, &quot;{function name}({value})&quot;, or &quot;{value}&quot;.
			From the &quot;{statement} starting point, we could see that &quot;{var} = {function name}({value})&quot; is the beginnings of a valid statement.
			However, we still need to define what the &quot;{var}&quot;, &quot;{function name}&quot;, and &quot;{val}&quot; tokens can be replaced with before we can construct a valid statement in this form (Wikipedia, 2018).
		</p>
		<p>
			Context-free grammars are used while building the syntax tree.
			With multiple possibilities for the subtokens used to replace a given supertoken, each layer in the tree only has a spot for the supertoken.
			The supertoken&apos;s object then contains the structure of the chosen replacement, along with the subtokens used by that replacement.
		</p>
		<div class="APA_references">
			<h2>References:</h2>
			<p>
				MyTutor. (n.d.). Describe the four stages of compilation. | MyTutor. Retrieved from <a href="https://www.mytutor.co.uk/answers/18623/A-Level/Computing/Describe-the-four-stages-of-compilation/"><code>https://www.mytutor.co.uk/answers/18623/A-Level/Computing/Describe-the-four-stages-of-compilation/</code></a>
			</p>
			<p>
				Wikipedia. (2018, November 14). Context-free grammar - Wikipedia. Retrieved from <a href="https://en.wikipedia.org/wiki/Context-free_grammar"><code>https://en.wikipedia.org/wiki/Context-free_grammar</code></a>
			</p>
		</div>
	</blockquote>
</section>
<section id="Minetest">
	<h2>Minetest</h2>
	<p>
		I spent a few hours developing Minetest mods instead of working.
		At first, I thought I just really needed a break, but should get back to work.
		I did get over half my reading material for the week completed though.
		But then I realised that it&apos;s Thursday.
		I should be at the $a[EUGLUG] meeting goofing off like this.
		I guess I made up for it by goofing off a bit at home.
	</p>
	<p>
		First of all, I&apos;ve finished up my <code>renew</code> mod update.
		It adds sledgehammers, which can be used for breaking down certain materials for acquiring other materials.
		Next, I added support for coloured protection nodes to my <code>blockprotectnodes</code> mod.
	</p>
	<p>
		That support comes in the form of compatibility with VanessaE&apos;s Unified Dyes mod.
		Her mod is ... less than ideal.
		The dye itself isn&apos;t paletted.
		Instead, it adds 256 <strong>*separate*</strong> dye items.
		As a result, a separate mixing recipe is needed for each pair of colours to be mixed.
		To avoid overloading the engine, not all pairs have a defined recipe, so many dye mixes can&apos;t be performed.
		In addition,  her palette is ... badly arranged.
		Don&apos;t get me wrong, it&apos;s quite lovely, but due to the way the engine works, the white colour needs to be in position zero.
		Items with no patelle index look white, but when placed in the world, they take on the colour of palette index zero.
		If that index is white, it&apos;s a perfect match.
		Otherwise, it looks glitchy.
		To account for that, she&apos;s added code that modifies the palette index of placed nodes that had no palette index before placing, setting them to <code>240</code> or so, where she has the white colour stashed.
		It&apos;s a hack that isn&apos;t needed; you just need to arrange your palette correctly to begin with.
		The palette does have a small colour choice issue as well: it provides perfect black.
		Due to the way Minetest handles palettes, any node using a perfect black palette colour will have no texture on it.
		It&apos;ll just be a pure black node.
		Because she&apos;s added this to the palette, every node that uses her palette wastes one of its limited palette indexes on something that is not only ugly, but identical to an option provided by each and every one of the nodes using her palette.
		This mod does provide a way to get the necessary dye colours from Minetest Game though, which is something my dye mod lacks.
		My mod&apos;s system doesn&apos;t have a way in Minetest Game to get cyan, magenta, or green dye in version 0.4.17.
		In Minetest Game 5.0.0, a green dye source gets added, but that doesn&apos;t help with the other two main dyes.
	</p>
	<p>
		Don&apos;t get me wrong.
		I appreciate all the effort VanessaE put into Unified Dyes.
		It&apos;s clear that a lot of care and planning went into this, and it really paid off.
		I just think my take on dyes is better in the ways that matter to me personally.
		It&apos;s an issue of differing opinions.
		As long as my mod has no way to craft all the dyes when in Minetest Game though, her mod remains vastly superior to mine when used in Minetest Game.
		And I don&apos;t see a crafting recipe for two of those dyes I need coming to me any time soon.
		My version will probably remain exclusive to Palette Game, where there are wild flowers in each of the eight base colours.
	</p>
	<p>
		Finally, with the colour support in place, I started work on that bag mod I&apos;ve been wanting to build.
		Mostly, I only have the inventory page for that, but I&apos;ve arranged it such that you have full access to your crafting grid and main inventory when accessing your bag.
		The original crafting page is left intact for players that would feel overloaded by having the bag open all the time, but for people that can manage it, there&apos;s no need to switch back and forth between the crafting page and the bag page.
	</p>
</section>
END
);
